package com.second.common.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: second-education-parent
 * @description:
 * @author: 王子朋
 * @create: 2023-05-22 19:08
 **/
@Data
@ApiModel(value = "统一的json对象")
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    @ApiModelProperty(value = "状态码 200表示成功 500表示失败 401表示权限不足 402表示未登录")
    private Integer code;
    @ApiModelProperty(value = "响应的消息")
    private String msg;
    @ApiModelProperty(value = "响应的数据")
    private Object data;

    public static Result success(){
        return new Result(200, "成功",null);
    }
    public static Result success(Object data){
        return new Result(200, "成功",data);
    }
    public static Result fail(){
        return new Result(500, "失败",null);
    }

    public static Result fail(String msg){
        return new Result(500, msg,null);
    }
}
